<?php

namespace App\Providers;

use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Fruitcake\Cors\CorsServiceProvider;
use Fruitcake\Cors\HandleCors;
use Iidestiny\LaravelFilesystemOss\OssStorageServiceProvider;
use Illuminate\Mail\MailServiceProvider;
use Illuminate\Support\ServiceProvider;
use Maatwebsite\Excel\ExcelServiceProvider;
use Spatie\Activitylog\ActivitylogServiceProvider;
use Spatie\Permission\PermissionServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if (env('APP_DEBUG')) {
            $this->app->register(CorsServiceProvider::class);
            $this->app->register(IdeHelperServiceProvider::class);

            $this->app->middleware([
                HandleCors::class,
            ]);
        }

        $this->app->register(\Barryvdh\Debugbar\LumenServiceProvider::class);
        $this->app->register(\Dingo\Api\Provider\LumenServiceProvider::class);
        $this->app->register(PermissionServiceProvider::class);
        $this->app->register(\Tymon\JWTAuth\Providers\LumenServiceProvider::class);
        $this->app->register(\Overtrue\LaravelLang\TranslationServiceProvider::class);
        $this->app->register(\Overtrue\LaravelWeChat\ServiceProvider::class);
        $this->app->register(ActivitylogServiceProvider::class);
        $this->app->register(OssStorageServiceProvider::class);
        $this->app->register(SDKServiceProvider::class);
        $this->app->register(ExcelServiceProvider::class);
        $this->app->register(MailServiceProvider::class);
    }
}
